package com.everflourish.yeah100.utils;

import com.everflourish.yeah100.entity.VersionInfo;
import com.everflourish.yeah100.entity.userinfo.LoginInfo;
import com.everflourish.yeah100.entity.userinfo.Role;
import com.everflourish.yeah100.utils.constant.RoleEnum;

import java.util.List;

public class Yeah100{
	/**
	 * 用户登录信息
	 */
	public static LoginInfo loginInfo;
	/**
	 * 用户角色
	 */
	public static RoleEnum mRoleEnum;
	/**
	 * 用户名
	 */
	public static String userId = null;
	/** 是否更新了用户的头像 */
	public static boolean isUpdateImageId;
	public static String userImageUrl = "";

	public static VersionInfo versionInfo;

	/**
	 * 是否已经激活过(序列号激活成功老师)
	 */
	public static boolean isActivated() {
		List<Role> roles = Yeah100.loginInfo.roles;
		if (roles != null) {
			for (Role r : roles) {
				if (r.name != null && r.name.equals(RoleEnum.TEACHER.name)) {
					// 已经激活过
					return true;
				}
			}
		}
		return false;
	}
}
